﻿@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

<script>
    function validate(data) {
        if (data.Redirect)
            window.location = data.Redirect;
    }
</script>



@using (Ajax.BeginForm("AjaxTest", "Home", new AjaxOptions { UpdateTargetId = "testcontainer", OnSuccess="validate" }, new { id="test-form"}))
{ 
    <input type="submit" value="Redirection Handling" />
}

<div id="testcontainer">
</div>



@using (Ajax.BeginForm("AjaxTestNoHandle", "Home", new AjaxOptions { UpdateTargetId = "testcontainer2"}, new { id="test-form"}))
{ 
    <input type="submit" value="No Redirection Handling" />
}

<div id="testcontainer2">
</div>

